projects
/
project
/
udebug.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
cb71f64
)
lib: fix avl tree lookup
author
Felix Fietkau
<
[email protected]
>
Mon, 27 Nov 2023 13:40:02 +0000
(14:40 +0100)
committer
Felix Fietkau
<
[email protected]
>
Mon, 27 Nov 2023 13:40:05 +0000
(14:40 +0100)
The delta between IDs can be bigger than INT_MAX, causing order mismatch
in the tree and lookup failures
Signed-off-by: Felix Fietkau <
[email protected]
>
lib.c
patch
|
blob
|
history
diff --git
a/lib.c
b/lib.c
index ec8c23d64da814b2dfca13dd34ca4ebdde0d39ee..caba7d9a1f9f25ab0c7b36a45c3e8539fe02b4f0 100644
(file)
--- a/
lib.c
+++ b/
lib.c
@@
-37,7
+37,11
@@
static void __randname(char *template)
int udebug_id_cmp(const void *k1, const void *k2, void *ptr)
{
uint32_t id1 = (uint32_t)(uintptr_t)k1, id2 = (uint32_t)(uintptr_t)k2;
- return id1 - id2;
+ if (id1 < id2)
+ return -1;
+ else if (id1 > id2)
+ return 1;
+ return 0;
}
static inline int